import httpx

class AsyncHttpClient:
    def __init__(self, headers: dict = None):
        """
        初始化 AsyncHttpClient 类
        :param headers: 默认请求头
        """
        self.headers = headers or {}
        self.client = httpx.AsyncClient(headers=self.headers)

    async def get(self, url: str, params: dict = None, **kwargs) -> httpx.Response:
        """
        发送异步 GET 请求
        :param url: 完整的请求 URL
        :param params: 查询参数
        :param kwargs: 其他参数
        :return: 响应对象
        """
        response = await self.client.get(url, params=params, **kwargs)
        return response

    async def post(self, url: str, data: dict = None, json: dict = None, **kwargs) -> httpx.Response:
        """
        发送异步 POST 请求
        :param url: 完整的请求 URL
        :param data: 表单数据
        :param json: JSON 数据
        :param kwargs: 其他参数
        :return: 响应对象
        """
        response = await self.client.post(url, data=data, json=json, **kwargs)
        return response

    async def put(self, url: str, data: dict = None, json: dict = None, **kwargs) -> httpx.Response:
        """
        发送异步 PUT 请求
        :param url: 完整的请求 URL
        :param data: 表单数据
        :param json: JSON 数据
        :param kwargs: 其他参数
        :return: 响应对象
        """
        response = await self.client.put(url, data=data, json=json, **kwargs)
        return response

    async def delete(self, url: str, **kwargs) -> httpx.Response:
        """
        发送异步 DELETE 请求
        :param url: 完整的请求 URL
        :param kwargs: 其他参数
        :return: 响应对象
        """
        response = await self.client.delete(url, **kwargs)
        return response

    async def close(self):
        """
        关闭异步 HTTP 客户端
        """
        await self.client.aclose()
